package com.karry.commons;

import com.baomidou.mybatisplus.mapper.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;

import java.util.Date;

public class MyMetaObjectHandler extends MetaObjectHandler {

    @Override
    public void insertFill(MetaObject metaObject) {
        setFieldValByName("deleted", 0, metaObject);
        setFieldValByName("createdTime", new Date(), metaObject);
        setFieldValByName("lastModifiedTime", new Date(), metaObject);
    }

    @Override
    public void updateFill(MetaObject metaObject) {
        setFieldValByName("lastModifiedTime", new Date(), metaObject);
    }
}
